interface Named {
    name:string
}

class Person {
    name:string
}

let p:Named
p = new Person()

let y = {name:"aaa",hhh:"666"}
let z = {name:444,hhh:"666"}
let w = {namedd:444,hhh:"666"}
p = y

function greet(n:Named){
    console.log("hhhh"+n.name);
    
}

greet(y)
greet(z) // 报错 类型不兼容
greet(w) // 报错 键name 和 namedd不兼容